package org.nicocube.airain.domain.client.action;

import java.io.Serializable;

import org.nicocube.airain.domain.client.character.GameCharacter;
import org.nicocube.airain.domain.client.gamedate.GameDate;

/**
 * This class represents what a {@link GameCharacter} can do on a given date.    
 * 
 * @author nico
 * @version 0.1
 */
public class Action implements Serializable {

	// as for version 0.1
	private static final long serialVersionUID = 1L;
	
	private ActionType type;
	private Long gameCharacterOrder;
	private GameDate gameDate;

	private Long order;
	
	/**
	 * Static Factory method for building {@link Action} 
	 * 
	 * @param type what kind of action 
	 * @param gameCharacterOrder the unique order of the {@link GameCharacter}
	 * @param gameDate the begin date of the action
	 * @return a brand new {@link Action}
	 */
	public Action(ActionType type,Long gameCharacterOrder,GameDate gameDate)  {
		this.type = type;
		this.gameCharacterOrder = gameCharacterOrder;
		this.gameDate = gameDate;
	}
	
	/**
	 * the constructor secured by protected access modifier
	 */
	protected Action() {}
	
	/**
	 * Retrieve the {@link ActionType} of the {@link Action} 
	 * @return the type
	 */
	public ActionType getType() {
		return type;
	}

	/**
	 * Retrieve the unique long order of the {@link GameCharacter}
	 * @return
	 */
	public Long getGameCharacter() {
		return gameCharacterOrder;
	}

	/**
	 * Retrieve the {@link GameDate} of begining of the {@link Action}
	 * @return
	 */
	public GameDate getGameDate() {
		return gameDate;
	}
	
	/**
	 * Modify the {@link GameDate} of begining of the {@link Action} 
	 * @param gameDate
	 */
	public void changeGameDate(GameDate gameDate) {
		this.gameDate = gameDate;
	}

	public boolean isSaved() {
		return order !=null;
	}

}
